package com.cyj.dream.admin.service.system.impl;

import com.cyj.dream.admin.model.system.SysRolePermission;
import com.cyj.dream.admin.persistence.manager.systems.SysRolePermissionManager;
import com.cyj.dream.admin.service.system.SysRolePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 角色关联关系服务实现类
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.service.impl
 * @Author: ChenYongJia
 * @CreateTime: 2021-05-17 11:53
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Service
public class SysRolePermissionServiceImpl implements SysRolePermissionService {

    @Autowired
    private SysRolePermissionManager sysRolePermissionManager;

    /**
     * 查询角色权限关联关系表信息
     *
     * @param sysRolePermission 角色权限关联关系对象
     * @return java.util.List<com.dream.DreamChardonnay.model.system.SysRolePermission>
     * @date 2021-5-17 15:32:09
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public List<SysRolePermission> selectSysRolePermission(SysRolePermission sysRolePermission) {
        return sysRolePermissionManager.selectSysRolePermission(sysRolePermission);
    }

    /**
     * 为角色设置权限
     *
     * @param sysRoleId       角色id
     * @param sysPermissionId 权限id集合
     * @return boolean
     * @date 2021-5-17 15:32:12
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean settingSysRolePermission(Long sysRoleId, List<Long> sysPermissionId) {
        return sysRolePermissionManager.settingSysRolePermission(sysRoleId, sysPermissionId);
    }

    /**
     * 为角色移除权限
     *
     * @param sysRoleId       角色id
     * @param sysPermissionId 权限id集合
     * @return boolean
     * @date 2021-5-17 15:32:15
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean deleteSysRolePermission(Long sysRoleId, List<Long> sysPermissionId) {
        return sysRolePermissionManager.deleteSysRolePermission(sysRoleId, sysPermissionId);
    }

}
